package com.tomek;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

import com.tomek.def.Drinks;

public class HibernateTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		UserBean user = new UserBean();
		user.setName("Tomasz");
		user.setLastName("Galuszka");
		user.setDrink(Drinks.HERBATA.getId());
		
		@SuppressWarnings("deprecation")
		SessionFactory sesionFactory = new Configuration().configure().buildSessionFactory();
		Session session = sesionFactory.openSession();
		session.beginTransaction();
		session.save(user);
		session.getTransaction().commit();
		session.close();
	}
	
}
